.ai-assistant-layout {
  position: relative;
  display: flex;
  width: 100%;
  height: 85vh;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  &::before {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    content: '';
  }

  .ai-assistant-sider {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 220px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);

    .sider-header {
      margin: 0 -1px;
      padding: 16px 16px 12px;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      border-bottom: 1px solid rgba(0, 0, 0, 0.06);

      .sider-title {
        margin: 0;
        color: #fff;
        font-weight: 700;
        font-size: 16px;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      }
    }

    .sider-content {
      flex: 1;
      padding: 16px;
      overflow-y: auto;

      .new-chat-btn {
        height: 40px;
        margin-bottom: 16px;
        font-weight: 600;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: none;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        transition: all 0.3s ease;

        &:hover {
          box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
          transform: translateY(-2px);
        }

        &:active {
          transform: translateY(0);
        }
      }

      .chat-category {
        .category-title {
          display: block;
          margin-bottom: 12px;
          color: #8c8c8c;
          font-weight: 600;
          font-size: 13px;
          letter-spacing: 0.5px;
          text-transform: uppercase;
        }

        .conversation-item {
          position: relative;
          margin-bottom: 4px;
          padding: 10px 12px;
          overflow: hidden;
          border: 2px solid transparent;
          border-radius: 8px;
          cursor: pointer;
          transition: all 0.3s ease;

          &::before {
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
            transition: left 0.5s;
            content: '';
          }

          &:hover {
            background: rgba(102, 126, 234, 0.08);
            border-color: rgba(102, 126, 234, 0.2);
            transform: translateX(4px);

            &::before {
              left: 100%;
            }
          }

          &.active {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-color: #667eea;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);

            .conversation-title {
              color: #fff;
              font-weight: 600;
            }
          }

          .conversation-title {
            position: relative;
            z-index: 1;
            color: #262626;
            font-weight: 500;
            font-size: 13px;
          }
        }
      }
    }
  }

  .ai-assistant-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    height: 85vh;
    padding: 0;
    overflow: hidden;
    background: transparent;

    .chat-container {
      display: flex;
      flex-direction: column;
      height: 100%;
      background: rgba(255, 255, 255, 0.1);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);

      .messages-container {
        display: flex;
        flex: 1;
        flex-direction: column;
        min-height: 0;
        padding: 16px 20px;
        overflow-y: auto;
        background: linear-gradient(
          180deg,
          rgba(255, 255, 255, 0.1) 0%,
          rgba(255, 255, 255, 0.05) 100%
        );

        > * + * {
          margin-top: 12px;
        }

        .message-wrapper {
          display: flex;
          width: 100%;

          &.user {
            justify-content: flex-end;

            .message-bubble {
              position: relative;
              max-width: 70%;
              color: #fff;
              background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
              border-radius: 20px 20px 6px 20px;
              box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);

              &::after {
                position: absolute;
                right: -8px;
                bottom: 0;
                width: 0;
                height: 0;
                border: 8px solid transparent;
                border-top-color: #764ba2;
                border-right: none;
                border-bottom: none;
                content: '';
              }
            }
          }

          &.assistant {
            justify-content: flex-start;

            .message-bubble {
              position: relative;
              max-width: 80%;
              color: #262626;
              background: rgba(255, 255, 255, 0.95);
              border: 1px solid rgba(255, 255, 255, 0.2);
              border-radius: 20px 20px 20px 6px;
              box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
              -webkit-backdrop-filter: blur(20px);
              backdrop-filter: blur(20px);

              &::after {
                position: absolute;
                bottom: 0;
                left: -8px;
                width: 0;
                height: 0;
                border: 8px solid transparent;
                border-top-color: rgba(255, 255, 255, 0.95);
                border-bottom: none;
                border-left: none;
                content: '';
              }
            }
          }

          .message-bubble {
            position: relative;
            padding: 12px 16px;
            animation: messageSlideIn 0.3s ease-out;

            .message-content {
              margin-bottom: 8px;
              font-size: 14px;
              line-height: 1.5;
            }

            .message-files {
              margin: 8px 0;

              .file-item {
                display: flex;
                align-items: center;
                margin-bottom: 4px;
                padding: 6px 10px;
                color: #595959;
                font-size: 12px;
                background: rgba(102, 126, 234, 0.1);
                border: 1px solid rgba(102, 126, 234, 0.2);
                border-radius: 6px;
                transition: all 0.2s ease;

                > * + * {
                  margin-left: 10px;
                }

                &:hover {
                  background: rgba(102, 126, 234, 0.15);
                  transform: translateX(4px);
                }

                &:last-child {
                  margin-bottom: 0;
                }
              }
            }

            .message-actions {
              display: flex;
              margin-top: 8px;
              opacity: 0;
              transition: all 0.3s ease;

              > * + * {
                margin-left: 6px;
              }

              .ant-btn {
                height: 24px;
                padding: 0 8px;
                color: #8c8c8c;
                font-size: 11px;
                background: rgba(0, 0, 0, 0.05);
                border: none;
                border-radius: 4px;
                transition: all 0.2s ease;

                &:hover {
                  color: #667eea;
                  background: rgba(102, 126, 234, 0.1);
                  transform: translateY(-1px);
                }
              }
            }

            &:hover .message-actions {
              opacity: 1;
            }
          }
        }
      }

      .input-container {
        flex-shrink: 0;
        height: 80px;
        min-height: 80px;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.95);
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);

        .input-wrapper {
          display: flex;
          align-items: flex-end;
          max-width: 900px;
          margin: 0 auto;

          > * + * {
            margin-left: 16px;
          }

          .message-input {
            flex: 1;
            max-height: 40px;
            padding: 8px 16px;
            font-size: 14px;
            background: rgba(255, 255, 255, 0.9);
            border: 2px solid rgba(102, 126, 234, 0.2);
            border-radius: 20px;
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
            transition: all 0.3s ease;
            resize: none;

            &:focus {
              background: rgba(255, 255, 255, 1);
              border-color: #667eea;
              box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
            }

            &::placeholder {
              color: #bfbfbf;
              font-weight: 400;
            }
          }

          .send-button {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            border-radius: 50%;
            box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
            transition: all 0.3s ease;

            &:hover {
              background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
              box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
              transform: translateY(-2px) scale(1.05);
            }

            &:active {
              transform: translateY(0) scale(1);
            }

            &:disabled {
              background: #d9d9d9;
              box-shadow: none;
              transform: none;
            }
          }
        }
      }
    }
  }
}

@keyframes messageSlideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

// 响应式设计
@media (max-width: 768px) {
  .ai-assistant-layout {
    .ai-assistant-sider {
      width: 200px;
    }

    .ai-assistant-content {
      .chat-container {
        .messages-container {
          padding: 12px 16px;

          .message-wrapper {
            .message-bubble {
              max-width: 85%;
              padding: 10px 14px;
            }
          }
        }

        .input-container {
          min-height: 70px;
          padding: 8px 12px;

          .input-wrapper {
            .message-input {
              max-height: 35px;
              font-size: 16px; // 防止iOS缩放
            }

            .send-button {
              width: 35px;
              height: 35px;
            }
          }
        }
      }
    }
  }
}

// 滚动条样式
.messages-container {
  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
  }

  &::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: all 0.3s ease;

    &:hover {
      background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    }
  }
}

// 额外的视觉效果
.ai-assistant-layout {
  .ai-assistant-sider {
    .conversation-item {
      &::after {
        position: absolute;
        top: 50%;
        right: 16px;
        width: 6px;
        height: 6px;
        background: #667eea;
        border-radius: 50%;
        transform: translateY(-50%);
        opacity: 0;
        transition: all 0.3s ease;
        content: '';
      }

      &.active::after {
        opacity: 1;
        animation: pulse 2s infinite;
      }
    }
  }
}

@keyframes pulse {
  0% {
    transform: translateY(-50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-50%) scale(1.2);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-50%) scale(1);
    opacity: 1;
  }
}

// 深色模式支持
@media (prefers-color-scheme: dark) {
  .ai-assistant-layout {
    .ai-assistant-sider {
      background: rgba(30, 30, 30, 0.95);
      border-right: 1px solid rgba(255, 255, 255, 0.1);

      .sider-content {
        .conversation-item {
          .conversation-title {
            color: #e0e0e0;
          }

          &:hover {
            background: rgba(102, 126, 234, 0.15);
          }
        }
      }
    }

    .ai-assistant-content {
      .chat-container {
        .messages-container {
          .message-wrapper {
            &.assistant .message-bubble {
              color: #e0e0e0;
              background: rgba(30, 30, 30, 0.95);
              border: 1px solid rgba(255, 255, 255, 0.1);
            }
          }
        }

        .input-container {
          background: rgba(30, 30, 30, 0.95);
          border-top: 1px solid rgba(255, 255, 255, 0.1);

          .input-wrapper {
            .message-input {
              color: #e0e0e0;
              background: rgba(50, 50, 50, 0.9);
              border-color: rgba(102, 126, 234, 0.3);

              &::placeholder {
                color: #888;
              }
            }
          }
        }
      }
    }
  }
}
